package com.example.chartmoudel;

import android.content.Context;

import android.support.annotation.NonNull;
import android.widget.TextView;

import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;

import java.util.ArrayList;
import java.util.List;

import static android.R.id.list;

/**
 * Created by xy on 2017/12/10.
 */

public class LineChartMarkerView extends MarkerView {

    private final List<String> mList=new ArrayList<>();
    private  TextView mTimeText;
    private  TextView mValueText;

    public LineChartMarkerView(Context context, int layoutResource,@NonNull List<String> list) {
        super(context, layoutResource);
        mList.addAll(list);
        mTimeText=findViewById(R.id.time);
        mValueText=findViewById(R.id.value);

    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
        mTimeText.setText(mList.get((int)e.getX()));
        mValueText.setText(""+e.getY());
        super.refreshContent(e, highlight);

    }
}
